////
////  JDImageToast.swift
////  funcode
////
////  Created by Wan Jiading on 2016/11/30.
////  Copyright © 2016年 WanJiading. All rights reserved.
////
//
//import UIKit
//
//class JDImageToast: NSObject, CAAnimationDelegate {
//	
//	static var toastView: JDImageToastView? = nil
//	
//	class func show(_ imageName: String, _ message: String) {
//	
//		toastView?.removeFromSuperview()
//		
//		toastView = JDImageToastView(imageName, message)
//		
//		SharedApplication.keyWindow!.addSubview(toastView!)
//	
//		let animGroup = CAAnimationGroup()
//		
//		let scaleAnim = CAKeyframeAnimation(keyPath: "transform.scale")
//		scaleAnim.values = [1.0, 1.01, 1.0, 0.99, 1.0]
//		
//		let alphaAnim = CAKeyframeAnimation(keyPath: "opacity")
//		alphaAnim.values = [1.0, 0.5, 1.0]
//		
//		animGroup.animations = [scaleAnim, alphaAnim]
//		animGroup.duration = 2
//		animGroup.repeatCount = MAXFLOAT
//		animGroup.isRemovedOnCompletion = true	// 退到后台，再次进入前台时，避免动画消失
//		
//		toastView?.layer.add(animGroup, forKey: nil)
//		
//		//
//		let tapGR = UITapGestureRecognizer(target: self, action: #selector(dismiss))
//		toastView?.addGestureRecognizer(tapGR)
//	}
//	
//	class func dismiss() {
//		
//		toastView?.layer.removeAllAnimations()
//		
//		self.perform(#selector(removeSelf), with: nil, afterDelay: 0.25)
//		
//		let scaleAnim = CAKeyframeAnimation(keyPath: "transform.scale")
//		scaleAnim.values = [1.0, 1.05, 1.0, 0.4]
//		scaleAnim.duration = 0.25
//		scaleAnim.repeatCount = 1
//		
//		scaleAnim.isRemovedOnCompletion = false
//		scaleAnim.fillMode = kCAFillModeBoth
//		toastView?.layer.add(scaleAnim, forKey: "dismissScale")
//
//	}
//	
//	@objc private class func removeSelf() {
//		toastView?.removeFromSuperview()
//	}
//	
//}
